	<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="jquery-1.11.3.js"></script>
	<script>
		
	$(function(){


		$(document).ajaxStart(function(){

			$Img = $("<img src='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1488433789960&di=aed91615f003559ac1549b908d7b57a9&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01368e57c51bba0000018c1be96be9.gif'>")
			$(".tip").children().html($Img);

		})

		$("#login_btn").click(function(){

			//验证略;

			var user = $("input[name=user]").val();
			var password = $("input[name=password]").val();


			//ajax请求接口;

			$.ajax({

				url:"http://datainfo.duapp.com/shopdata/userinfo.php",
				type:"POST",
				data:{
					status:"login",
					userID:user,
					password:password
				},
				success:function(res){

					//成功之后做什么;

					

					switch(res){

						case "0" : $(".tip").find("span").html("用户不存在,请注册");
						break;
						
						case "2": $(".tip").find("span").html("用户名和密码不符!!");
						break;

						default:$(".tip").find("span").html("登陆成功,我们稍微将为您跳转到购物页面");

						console.log(res);

					}


				},
				error:function(){

					alert("你特么把我服务器用坏了! 赔钱!")

				},


			})


		})

	})	


	</script>



</head>
<body>
	
	<div class="register">
			
			<h2>登陆</h2>
	
			<p>账号:<input type="text" name="user"></p>
			<p>密码:<input type="password" name="password"></p>
			<p class="tip">提示: <span></span> </p>
			<input type="button" value="确认登陆" id="login_btn">
	
	</div>



</body>
</html>